Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

199
Visualizações
"Method expression is not of Function type"

I have the following JavaScript Code:

const { Command } = require('commander');
const program = new Command();

const createPassword = require('./createPassword')

program.version('1.0.0').description('Commandline Password Generator');

program
    .option('-l, --length <number>', "Length of your Password", '8')
    .option('-nn, --no-numbers', "Remove Numbers")
    .option('-ns, --no-symbols', "Remove Symbols")
    .option('-s, --save', "Save Password to passwords.txt")
    .parse();

const { length, save, numbers, symbols } = program.opts();

// Get generated Password
const generatedPassword = createPassword(length, numbers, symbols);

The "createPassword" File looks like this:

const alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
const numbers = '1234567890'
const symbols = '!@#$%^&*_-+='

let createPassword = (length = 9, hasNumbers = true, hasSymbols = true) => {
    let chars = alpha;

    hasNumbers ? (chars += numbers) : '';
    hasSymbols ? (chars += symbols) : '';
    return chars;
}

module.exports = createPassword();

The output is the following:

const generatedPassword = createPassword(length, numbers, symbols);
                          ^

TypeError: createPassword is not a function

I know, that this question was asked about 6 or 7 Years ago and I tried everything but it just does not work. Node is installed in the current version and so is jQuery.

What on earth am I doing wrong?

enter image description here

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda